From b20f2d26b4b4ffa68bc92d339ab86c61612009da Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 11 Dec 2009 17:17:38 +0100 Subject: [PATCH] Reset the pressed state of a button when the screen changes Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=599397 --- gtk/gtkbutton.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index db4680499d..2f8b98f39a 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -2137,12 +2137,23 @@ static void gtk_button_screen_changed (GtkWidget *widget, GdkScreen *previous_screen) { + GtkButton *button; GtkSettings *settings; guint show_image_connection; if (!gtk_widget_has_screen (widget)) return; + button = GTK_BUTTON (widget); + + /* If the button is being pressed while the screen changes the + release might never occur, so we reset the state. */ + if (button->button_down) + { + button->button_down = FALSE; + gtk_button_update_state (button); + } + settings = gtk_widget_get_settings (widget); show_image_connection = @@ -2159,7 +2170,7 @@ gtk_button_screen_changed (GtkWidget *widget, I_("gtk-button-connection"), GUINT_TO_POINTER (show_image_connection)); - show_image_change_notify (GTK_BUTTON (widget)); + show_image_change_notify (button); } static void -- 2.30.2